package tests;

import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;


public class Exo2FlowLayout extends JPanel {
	private static final long serialVersionUID = 837932151790826136L;

	private JFrame frame;
	
	public Exo2FlowLayout() {
		this.setLayout(new FlowLayout(FlowLayout.CENTER));
		for(int i=1; i<17; i++){
			JButton button = new JButton("Bouton " + i);
			this.add(button);
		}
		this.createFrame();
	}

	
	public void createFrame(){
		frame = new JFrame("JFrame");
		frame.getContentPane().add(this);
		frame.setSize(400, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
	}

	public static void main(String[] args) {
		new Exo2FlowLayout();
	}

}
